package com.my.system.command;

import com.my.system.object.client.Client;
import com.my.system.object.client.User;

public abstract class CommandFactory {
	public enum CommandCode {
		// system
		EXIT, HELP, LOGIN, SIGNUP,PRODUCT,

		//client
		CREATEORDER,ORDER_LIST,USER,BUYPRODUCT,PAYORDER,
		
		//USER
		BALANCE,RECHARGE,TRANSFER
	}

	public static CommandFactory getFactory(Client client, User user) {
		if (client == null && user == null) {
			return new SystemCommandFactory(client,user);
		} else if (client != null && user == null) {
			return new ClientCommandFactory(client,user);
		}
		return new UserCommandFactory(client,user);

	}

	public abstract Command buildCommand(CommandCode code);

}
